Added solution#2017
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
I am requesting changes because one explicit requirement was to modify only src/scripts/main.js, but there are additional edits in workflow and package-related files, which violates the checklist and can affect the project setup. Functionally, your sortList(list) and getEmployees(list) implementations look correct: salaries are parsed numerically from data-salary, sorting is in descending order, and the returned employee objects have name, position, salary, and age as required. However, altering files beyond main.js is a critical checklist violation and must be reverted to keep the submission scoped correctly.
Critical issues to fix:
- Revert all changes outside
src/scripts/main.js(for example,.github/workflowsandpackage.json/related files) so that onlymain.jsis modified, as the task explicitly restricts changes to that file.
Minor (non-blocking) suggestions:
- Consider storing the result of
getEmployees(listElements)in a variable (e.g.,const employees = getEmployees(listElements);) so it’s clear that the function’s output is intended to be used. - Optionally, rename
convertToNumberto something likeparseSalaryfor better readability.
Once you revert the extra file changes, your logic in main.js should fully satisfy the requirements, and overall you’ve done a solid job implementing the sorting and employee extraction behavior.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Important
Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.
Tip
If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.
Caution
Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.
Footnotes
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your solution is approved because it correctly implements all required functionality in src/scripts/main.js and matches the checklist items. The list items are fetched via querySelectorAll('li') and the ul via querySelector('ul'), and sortList(list) uses dataset.salary plus a numeric conversion helper to sort salaries in descending order and re-append the items to the list, fulfilling the sorting requirements [CHECKLIST ITEM #1, #3, #10–#14]. getEmployees(list) correctly builds and returns an array of employee objects with the required fields (name, position, salary, age) from the data attributes, which matches the specified schema [CHECKLIST ITEM #2, #4–#6, #15]. Both sortList and getEmployees are called at the bottom of the file, and you respected the constraint to only modify main.js without touching HTML/CSS [CHECKLIST ITEM #7, #8, #16, #18].
There are no critical blockers or broken functionality based on the task description and checklist, so the implementation meets the core requirements. As minor, non-blocking suggestions, you could store the result of getEmployees in a variable (e.g. const employees = getEmployees(listElements);) to make its use clearer [CHECKLIST ITEM #20], and consider a more domain-specific name like parseSalary for the helper function to improve readability [CHECKLIST ITEM #21]. Overall, you’ve done a solid job implementing the required logic and keeping changes scoped appropriately—well done.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
No description provided.